package com.buer.storage.jobs;

import com.buer.storage.service.OaSynchronizationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * Created by Administrator on 2021/1/27.
 */
@Component
public class OaSynchronizationJob {

    @Autowired
    private OaSynchronizationService oaSynchronizationService;

    /**
     * 同步库存--完全同步
     *
     * @return void
     **/
    //@Scheduled(cron = "0 0 1 * * ?") //每天凌晨1点执行一次
    @Scheduled(cron = "0 */2 * * * ?") //每隔2分钟执行一次
    private void process() {
        oaSynchronizationService.synchronizationOa();
    }

    /**
     * 同步库存--部分同步
     *
     * @return void
     **/
    //@Scheduled(cron = "0 */1 * * * ?") //每隔1分钟执行一次
    private void partProcess() {
        oaSynchronizationService.synchronizationPartOa();
    }

    /**
     * 出库单同步
     *
     * @return void
     **/
    @Scheduled(cron = "5 * * * * ?")
    private void deliverySynchronization() {
        oaSynchronizationService.deliverySynchronization();
    }
}
